/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author clayton
 */
@Entity 
@Table(name = "sweetie")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Sweetie.findAll", query = "SELECT s FROM Sweetie s"),
    @NamedQuery(name = "Sweetie.findBySweetieId", query = "SELECT s FROM Sweetie s WHERE s.sweetieId = :sweetieId"),
    @NamedQuery(name = "Sweetie.findBySweetieUrl", query = "SELECT s FROM Sweetie s WHERE s.sweetieUrl = :sweetieUrl")
})
public class Sweetie implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "sweetie_id")
    private Long sweetieId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2083)
    @Column(name = "sweetie_url")
    private String sweetieUrl;
    @ManyToMany(mappedBy = "sweetieCollection")
    private Collection<KungkhieImpl> kungkhieImplCollection;
    @ManyToMany(mappedBy = "sweetieCollection")
    private Collection<Activity> activityCollection;

    public Sweetie()
    {
    }

    public Sweetie(Long sweetieId)
    {
        this.sweetieId = sweetieId;
    }

    public Sweetie(Long sweetieId, String sweetieUrl)
    {
        this.sweetieId = sweetieId;
        this.sweetieUrl = sweetieUrl;
    }

    public Long getSweetieId()
    {
        return sweetieId;
    }

    public void setSweetieId(Long sweetieId)
    {
        this.sweetieId = sweetieId;
    }

    public String getSweetieUrl()
    {
        return sweetieUrl;
    }

    public void setSweetieUrl(String sweetieUrl)
    {
        this.sweetieUrl = sweetieUrl;
    }

    @XmlTransient
    public Collection<KungkhieImpl> getKungkhieImplCollection()
    {
        return kungkhieImplCollection;
    }

    public void setKungkhieImplCollection(Collection<KungkhieImpl> kungkhieImplCollection)
    {
        this.kungkhieImplCollection = kungkhieImplCollection;
    }

    @XmlTransient
    public Collection<Activity> getActivityCollection()
    {
        return activityCollection;
    }

    public void setActivityCollection(Collection<Activity> activityCollection)
    {
        this.activityCollection = activityCollection;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (sweetieId != null ? sweetieId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sweetie))
        {
            return false;
        }
        Sweetie other = (Sweetie) object;
        if ((this.sweetieId == null && other.sweetieId != null) || (this.sweetieId != null && !this.sweetieId.equals(other.sweetieId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.Sweetie[ sweetieId=" + sweetieId + " ]";
    }

}
